<template>
  <div class="newsInfo_box">
    <h2>{{message.title}}</h2>
    <div class="time_click">
        <span>发表时间:{{message.add_time | timeL}}</span>
        <span>点击{{message.click}}次</span>
    </div>
    <hr>
    <div v-html="message.content">

    </div>
    <comment :id=id></comment>
  </div>
</template>
<script>

// 引用评论组件
import comment from '../comment/comment.vue'
export default {
  data() {
    return {
      id:this.$route.params.id,
      message:''
    };
  },
  created(){
      this.getInfo()
  },
  methods:{
      getInfo(){
          this.$http.get('api/getnew/'+this.id).then(res=>{
               if(res.body.status===0){
                  this.message=res.body.message[0];
                  
              }else{
                  Toast("获取新闻详情失败！");
              }
          })
      }
  },
  components:{comment}
}
</script>
<style lang="scss">
  .newsInfo_box{
      margin: 5px;
      h2{
          font-size: 15px;
          text-align: center;
          margin: 5px 0;
      }
    .time_click{
        font-size: 13px;
        color: #26a2ff;
        display: flex;
        justify-content: space-between;
    }
  }
</style>